package me.xhy.java.springboot3.r2dbc.s04repository.s044repository;

import me.xhy.java.springboot3.r2dbc.s04repository.s043entity.S043Entity;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

@Repository
public interface S044Demo1Repository extends R2dbcRepository<S043Entity, String> {
  // ctrl + F12 查看方法列表。 可以看到默认继承了很多CRUD方法
  /*ctrl + H 查看类图
  SimpleR2dbcRepository<T, ID> implements R2dbcRepository<T, ID>
  R2dbcRepository<T, ID> extends ReactiveCrudRepository<T, ID>, ReactiveSortingRepository<T, ID>, ReactiveQueryByExampleExecutor<T>
  */

  // where id = ? and tenant_id like ?
  Flux<S043Entity> findAllByIdInAndTenantIdLike(Long[] idList, String deptId);


  // 可以写复杂SQL 和 多表SQL
  @Query("select id from xs1_t_demo1")
  Flux<S043Entity> findBySql1();


}
